import request from '@/utils/request'

// export interface ApiInfo {
//   id: number | null;
//   suiteId: number | null;
//   suiteFlag?: number | null;
//   apiCode: string;
//   apiUrl: string;
//   apiName: string;
//   apiDesc: string;
//   apiRequestType: string;
//   apiRequestContentType: string;
//   apiHeaders: ApiHeader[];
//   apiInputParams: InputParams[];
//   apiOutputParams: OutputParams[];
// }


/**
 * @description
 * @author Golduck
 * @date 06/05/2025
 * @export
 * @param {{
 *   pageNum;
 *   pageSize;
 *   suiteId?;
 *   apiName?;
 *   apiUrl?;
 * }} params
 * @return {*}  {ResponsePageResult}
 */
export async function listQuery(params) {
  return request.post('/v1/api/page', params);
}

/**
 * @description
 * @author Golduck
 * @date 06/05/2025
 * @export
 * @param {{
 *   suiteId;
 *   apiUrl;
 *   apiName;
 *   apiDesc;
 *   apiRequestType;
 *   apiRequestContentType;
 * }} params
 * @return {*}  {ResponseResult<boolean>}
 */
export async function listAdd(params) {
  return request.post('/v1/api/add', params);
}

/**
 * @description
 * @author Golduck
 * @date 06/05/2025
 * @export
 * @param {{
 *   id;
 *   suiteId?;
 *   apiUrl?;
 *   apiName?;
 *   apiDesc?;
 *   apiRequestType?;
 *   apiRequestContentType?;
 * }} params
 * @return {*}  {ResponseResult<boolean>}
 */
export async function listUpdate(params) {
  return request.put('/v1/api/update', params);
}

export async function listDelete(id) {
  return request.delete(`/v1/api/delete/${id}`);
}

export async function queryApiInfo(id) {
  return request.get(`/v1/api/info/${id}`);
}

export async function queryApiInfoByCode(apiCode) {
  return request.get(`/v1/api/info/code/${apiCode}`);
}
/**
 * @description
 * @author Golduck
 * @date 06/05/2025
 * @export
 * @param {*} apiId
 * @param {{ headerData: any; inputParamData: any }} params
 * @return {*}  {ResponseResult<any>}
 */
export function debugApi(apiId, params) {
  return request.post(`/v1/api/debug/${apiId}`, params);
}

export async function getApiListBySuiteId(suiteId) {
  return request.post(`/v1/api/getApiListBySuiteId/${suiteId}`);
}

export async function getApiListBySuiteCode(suiteCode) {
  return request.post(`/v1/api/getApiListBySuiteCode/${suiteCode}`);
}
